{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![](img/1.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "在学习Matplotlib前，看上面这张图，我们需要了解一些概念："
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Figure:整个图形区域的总称；"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Centred title : Figure 的标题名称"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Axes : 英文是轴得意思，可以理解为单独，不同的图标"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Axes title : Axes 的标题名称"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "x-axes label : x 坐标轴的标签"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "y-axes label : y 坐标轴的标签"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "通过%matplotlib.inline可以在notebook中嵌入图表，导入matplotlib.pyplot并重命名为plt。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "UsageError: Line magic function `%matplotlib.inline` not found.\n"
     ]
    }
   ],
   "source": [
    "%matplotlib.inline\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = [1,2,3,4]\n",
    "y = [11,22,33,44]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAlsAAAJDCAYAAAA8QNGHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALE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uSfq+pfu/u/h2fj5dtVs0zH1tI+6ofTbqF9qap3Jbk1yZXd/fPTNBs7W2T/1pLcsRFa5yW5qqpOdPe3TsuEvJRF/+18rrt/neTXVXVvkkuTiK0za5G9uz7J3/f6i4COVdVPk1yS5N9Pz4i8DLtqlumnEX3Uz+race+qan+SO5N80v+mzzo77l93X9Tdb+vutyX5xyR/K7TOGov82/ntJB+sqr1V9Zok70vy2Gmek9+1yN49mfUrkqmqt2T9A46fOK1Tslu7apbRK1vto35W1oJ797kkb0ry1Y2rIyfaB6yeFRbcP85Si+xfdz9WVd9L8nCSF5Pc2t3b/rk6p8+Cv3tfSHJ7VT2S9aelburu587Y0PxWVX0jyeVJzquq40k+n+RVyctrFu8gDwAwyDvIAwAMElsAAIPEFgDAILEFADBIbAEADBJbAACDxBYAwCCxBQAw6H8BU0gXwe5IAxEAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 720x720 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig,ax = plt.subplots(figsize=(10,10))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x25ff5cb5610>]"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ax.plot(x,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[Text(0.5, 1.0, 'demo'),\n",
       " Text(0.5, 3.200000000000003, 'x-axis'),\n",
       " Text(3.200000000000003, 0.5, 'y-axis')]"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ax.set(title='demo',xlabel=\"x-axis\",ylabel=\"y-axis\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "fig.savefig(\"img/sample-plot.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "f0eadef1d77f15b2dc417c8cc1a73e43ff71cc62600b9af0dbbd14bf3385942a"
  },
  "kernelspec": {
   "display_name": "Python 3.9.12",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
